﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MebApp.Launcher.Helpers
{
    public class FileHelper
    {
        /// <summary>
        /// 返回临时文件路径
        /// </summary>
        /// <param name="bytes"></param>
        /// <returns></returns>
        public static string WriteTemp(byte[] bytes)
        {
            var tempFile = Path.GetTempFileName();
            using (var tempFileStream = File.Open(tempFile, FileMode.Open))
            {
                tempFileStream.Write(bytes, 0, bytes.Length);
                tempFileStream.Flush();
            }
            return tempFile;
        }
    }
}
